package com.cakemallproject.mapper;

import com.cakemallproject.pojo.mapperObj.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsMapper {
    @Select("select * from goods where status != 0")
    List<Goods> list();

    void update(Goods goods);

    void delete(List<Integer> ids);

    @Insert("insert goods(tid, name, cover, price, intro, stock) values(#{tid},#{name},#{cover},#{price},#{intro},#{stock})")
    void insert(Goods goods);

    @Select("select * from goods where status != 0 and gid = #{gid}")
    Goods getById(Integer gid);


    List<Goods> search(
            @Param("value") String value,
            @Param("ids") List<Integer> ids
    );

    @Select("select * from goods where status != 0 and tid = #{tid}")
    List<Goods> getByTid(Integer tid);
}
